<%@ page
		contentType="text/html;charset=utf-8"
		language="java"
%>
<%@ taglib
		prefix="c"
		uri="http://java.sun.com/jsp/jstl/core"
%>
<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<link rel="stylesheet" href="layui/css/layui.css" />
	</head>
	<body>
		<div style="width: 50%; margin: 100px auto;">
			<form class="layui-form"
				  method="post"
				  action="${pageContext.request.contextPath}/NewsServlet?method=add">
				<input type="hidden" name="id" value="${news.id}"/>
				<div class="layui-form-item layui-form-pane">
					<label class="layui-form-label">标题</label>
					<div class="layui-input-block">
						<input type="text"
							   name="title"
							   class="layui-input"
							   placeholder="请输入标题"
							   lay-verify="required"
							   autocomplete="off"
							   value="${news.title}" />
					</div>
				</div>
				
				<div class="layui-form-item layui-form-pane">
					<label class="layui-form-label">内容</label>
					<div class="layui-input-block">
						<input type="text"
							   name="content"
							   placeholder="请输入内容"
							   class="layui-input"
							   autocomplete="off"
							   lay-verify="required"
							   value="${news.content}" />
					</div>
				</div>
				<div class="layui-form-item layui-form-pane">
					<label class="layui-form-label">分类</label>
					<div class="layui-input-block">
						<input type="text"
							   name="type"
							   placeholder="请输入分类"
							   class="layui-input"
							   autocomplete="off"
							   lay-verify="required"
							   value="${news.type}"/>
					</div>
				</div>
				
				<div class="layui-form-item layui-form-pane">
					<label class="layui-form-label">发布者</label>
					<div class="layui-input-block">
						<input type="text"
							   name="publisher"
							   class="layui-input"
							   placeholder="请输入发布者"
							   lay-verify="required"
							   autocomplete="off"
							   value="${news.publisher}"/>
					</div>
				</div>
				
				<div class="layui-form-item layui-form-pane">
					<label class="layui-form-label">发布部门</label>
					<div class="layui-input-block">
						<input type="text"
							   name="department"
							   class="layui-input"
							   lay-verify="required"
							   autocomplete="off"
							   placeholder="请输入发布部门"
							   value="${news.department}" />
					</div>
				</div>

				<div class="layui-form-item layui-form-pane">
					<label class="layui-form-label">浏览量</label>
					<div class="layui-input-block">
						<input type="text"
							   name="count"
							   class="layui-input"
							   lay-verify="required"
							   autocomplete="off"
							   placeholder="请输入浏览量"
							   value="${news.count}" />
					</div>
				</div>

				<input type="hidden" name="id" value="">
				
				<div class="layui-form-item">
					<label class="layui-form-label"></label>
					<div class="layui-input-block">
						<button class="layui-btn"
								lay-submit
								lay-filter="new" >
							立即提交
						</button>
						<input type="reset" class="layui-btn" />
						<a class="layui-btn"
						   href="${pageContext.request.contextPath}/NewsServlet?method=query">
							返回首页
						</a>
					</div>
				</div>
			</form>
		</div>
		
		<script src="layui/layui.js"></script>
		
		<script>
			/*使用的模块*/
			window.msg = "${msg}"
			layui.use(['form','layer', 'laydate'],function(){
				form = layui.form;
				laydate = layui.laydate;
				layer = layui.layer;

				form.on("submit(new)",function(data){
					return true;
				});

				if(window.msg!=undefined && window.msg!=""){
					layer.msg(window.msg);
					window.msg="";
				}
			});
		</script>
	</body>
</html>
